import { Boolean, Code, Cover, CreateDate, DateTime, Entity, PrimaryUuid, Remark, SysUserId, Text, Title, Unique, UpdateDate } from "@sker/core";

@Entity({ name: 'wx_account' })
@Unique('UK_WX_ACCOUNT_ID', ['name'])
export class WxAccount {

    @PrimaryUuid({
        primaryKeyConstraintName: "PK_WX_ACCOUNT_ID"
    })
    id: string;

    @SysUserId({
        comment: '所属用户'
    })
    uid: string;

    @Code()
    name: string;

    @Cover({
        comment: '小程序头像'
    })
    avatar: string;

    @Title({
        comment: '小程序名字'
    })
    title: string;

    @Code({
        comment: 'APPID'
    })
    appid: string;

    @Code({
        comment: 'SECRET'
    })
    secret: string;

    @Boolean({ comment: '默认', default: false })
    is_default: boolean;

    @Code({
        comment: '授权凭证',
        nullable: true,
        default: ''
    })
    access_token: string;

    @DateTime({
        comment: '过期时间',
        nullable: true,
    })
    exp_date: Date;

    @Boolean({
        comment: '是否可用',
        default: true,
    })
    status: boolean;

    @Remark({
        comment: '关闭原因',
        default: ''
    })
    reson: string;

    @CreateDate()
    create_date: Date;

    @UpdateDate()
    udpate_date: Date;
}